package demo;

public class Demo {
    public static void main(String[] args) {
        String s = "lrloseumgh";
        int n = 6;
        String result = reverseLeftWords(s, n);
        System.out.println(s.substring(2, s.length()) + s.substring(0, 2));
    }

    public static int maxDepth(TreeNode root) {
        int deep = 0;
        if (root == null) {
            return 0;
        }else {
            while (root.left != null || root.right != null) {
                deep ++;
                int leftDeep = maxDepth(root.left);
                int righntDeep = maxDepth(root.right);
                deep = deep + (leftDeep >= righntDeep ? leftDeep : righntDeep);
                return deep;
            }
        }
        return deep;
    }

    public static String reverseLeftWords(String s, int n) {
        if (n == 0) {
            return s;
        } else {
            return s.substring(n, s.length()) + s.substring(0, n);
        }
    }
}

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;

    TreeNode(int x) {
        val = x;
    }
}
